import {Component} from '@angular/core';
import {Router} from '@angular/router';
import {ElectronService} from './core/services';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
})
export class AppComponent {
  title = 'myelectron15';
  workEnv = {
    isElectron: false,
    chrome: '',
    node: '',
    electron: ''
  }

  constructor(
    private router: Router,
    private electronService: ElectronService,
  ) {

    if (electronService.isElectron) {
      console.log(process.env);
      console.log('Run in electron');
      console.log('Electron ipcRenderer', this.electronService.ipcRenderer);
      console.log('NodeJS childProcess', this.electronService.childProcess);
      this.workEnv = {
        isElectron: true,
        chrome: window.process.versions['chrome'],
        node: window.process.versions['node'],
        electron: window.process.versions['electron'],
      }
    } else {
      console.log('Run in browser');
      this.workEnv.isElectron = false
    }
  }
}
